﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ShowEmployeeLeaves.aspx.cs"
    Inherits="Actuals.ShowEmployeeLeaves" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="~/Actuals.css" rel="Stylesheet" type="text/css" />
    <script type="text/javascript">
        function ShowAddEmployeeLeaves() {
            var url = "AddEmployeeLeaves.aspx";
            var result = window.showModalDialog(url,this, 'dialogWidth:500px;dialogHeight:500px;Scrollbar:yes;Status:no;Help:no;centre:yes');

        }

        function TestCheckBox() {
            var target = null;
            target = document.getElementById("<%=this.gvResults.ClientID %>");  
            if (target == null) {
                alert("No record is selected!,Please select one!");
                return false;
            }
            var Inputs = document.getElementsByTagName("input");
            for (var n = 0; n < Inputs.length; ++n) {
                if (Inputs[n].type == "checkbox" && Inputs[n].checked)
                    return confirm("Do you want to Delete");
            }

            alert("No record is selected!, Please select one!");
            return false;

        }
    </script>

      <script type="text/javascript" src="<%=ResolveUrl("~/Scripts/jquery.js") %>"></script>
    <script type="text/javascript" src="<%=ResolveUrl("~/Scripts/jquery.ui.datepicker.js") %>"></script>
    <script type="text/javascript" src="<%=ResolveUrl("~/Scripts/jquery.ui.core.js") %>"></script>
    <script type="text/javascript">

        $(document).ready(function () {
            $("#<%=txtFromDate.ClientID %>").datepicker({ dateFormat: 'dd-mm-yy', changeMonth: true, changeYear: true, yearRange: '2011:2013' });
            $("#<%=txtToDate.ClientID %>").datepicker({ dateFormat: 'dd-mm-yy', changeMonth: true, changeYear: true, yearRange: '2011:2013' });
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <center>
        <div>
            <asp:Label ID="Label2" runat="server" CssClass="ParaTitle">Employee Leaves</asp:Label><br />
            <asp:Label ID="lblMsg" runat="server" CssClass="message"></asp:Label>
        </div>
        <div id="divEmployeeLeaves">
            <table>
                <tr>
                    <td>
                        <asp:Label ID="Label1" runat="server" CssClass="label">Year</asp:Label>
                    </td>
                    <td align="left">
                        <asp:DropDownList ID="DropDownList1" runat="server" CssClass="textfield">
                            <asp:ListItem Value="0">Select</asp:ListItem>
                            <asp:ListItem Value="2009">2009</asp:ListItem>
                            <asp:ListItem Value="2010">2010</asp:ListItem>
                            <asp:ListItem Value="2011">2011</asp:ListItem>
                            <asp:ListItem Value="2012">2012</asp:ListItem>
                            <asp:ListItem Value="2013">2013</asp:ListItem>
                            <asp:ListItem Value="2014">2014</asp:ListItem>
                            <asp:ListItem Value="2015">2015</asp:ListItem>
                            <asp:ListItem Value="2016">2016</asp:ListItem>
                            <asp:ListItem Value="2017">2017</asp:ListItem>
                            <asp:ListItem Value="2018">2018</asp:ListItem>
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="LblFromDate" runat="server" CssClass="label">FromDate</asp:Label>
                    </td>
                    <td align="left">
                        <asp:TextBox ID="txtFromDate" runat="server" CssClass="textfield"></asp:TextBox>
                    </td>
                    <td>
                        <asp:Label ID="LblToDate" runat="server" CssClass="label">ToDate</asp:Label>
                    </td>
                    <td align="left">
                        <asp:TextBox ID="txtToDate" runat="server" CssClass="textfield"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="lblTeam" runat="server" CssClass="label">Team</asp:Label>
                    </td>
                    <td align="left">
                        <asp:DropDownList ID="ddlTeam" runat="server" CssClass="textfield" OnSelectedIndexChanged="ddlTeam_OnSelectedIndexChanged"
                            AutoPostBack="true">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="Label3" runat="server" CssClass="label">Team Member</asp:Label>
                    </td>
                    <td align="left">
                        <asp:DropDownList ID="ddlTeamMemeber" runat="server" CssClass="textfield">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <asp:Button ID="btnEmployeeLeaves" runat="server" Text="Show EmployeeLeaves" OnClick="btnEmployeeLeaves_Click" />
                    </td>
                </tr>
            </table>
            <div id="divGrid" style="border: solid 1px silver; height: 400px; text-align: center;
                overflow-x: hidden; overflow-y: auto;">
                <asp:GridView ID="gvResults" runat="server" AutoGenerateColumns="false" BorderColor="Black"
                    AllowPaging="false" AllowSorting="true" ShowFooter="true">
                    <HeaderStyle BackColor="White" Font-Size="10px" ForeColor="#990000" BorderStyle="None" />
                    <RowStyle BackColor="#F7F3F7" Font-Names="Verdana" Font-Size="XX-Small" BorderStyle="None" />
                    <AlternatingRowStyle BackColor="White" Font-Names="Verdana" Font-Size="XX-Small"
                        BorderStyle="None" />
                    <Columns>
                        <asp:TemplateField HeaderStyle-Width="5%" ItemStyle-Width="5%" ItemStyle-BorderStyle="None"
                            HeaderStyle-BorderStyle="None">
                            <ItemTemplate>
                                <asp:CheckBox ID="chkShowEmployeeLeave" runat="server" AutoPostBack="false" />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField Visible="false">
                            <ItemTemplate>
                                <asp:Label ID="lblEmpId" runat="server" Text='<%# Bind("EmpId") %>' />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Employee">
                            <ItemTemplate>
                                <asp:Label ID="lblEmp" runat="server" Text='<%# getEmpName(Eval("EmpId")) %>' />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="LeaveDate">
                            <ItemTemplate>
                                <asp:Label ID="lblLeaveDate" runat="server" Text='<%# getDateFormat(Eval("LeaveDate")) %>' />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="LeaveType">
                            <ItemTemplate>
                                <asp:Label ID="lblLeaveType" runat="server" Text='<%# getLeaveType(Eval("LeaveType")) %>' />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="AM">
                            <ItemTemplate>
                                <asp:Label ID="lblAM" runat="server" Text='<%# Bind("AM") %>' />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="PM">
                            <ItemTemplate>
                                <asp:Label ID="lblPM" runat="server" Text='<%#Bind("PM") %>' />
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
            </div>
            <asp:Button ID="btnAddEmployeeLeave" runat="server" Text="AddLeaves" CssClass="button"
                OnClientClick="return ShowAddEmployeeLeaves()" />
            <asp:Button ID="btnDelete" runat="server" CssClass="button" Text="Delete" OnClientClick=" return TestCheckBox();"
                OnClick="btnDelete_Click" />
        </div>
    </center>
    </form>
</body>
</html>
